class FetionSm < ActiveResource::Base
  self.site = Rails.env.production? ? "http://localhost:4848" : "http://localhost:9000"
  
  # crack ::Base because of error 
  def create
    connection.post(collection_path(attributes), encode, self.class.headers).tap do |response|
      self.id = id_from_response(response)
      load_attributes_from_response(response)
    end
  end
  
  def create!(options = {  })
    create
    raise state if state != 'SUCCESS' 
    #发送短信
    UserSmsEmailsDailyStat.today_stat_by_mobile(mobile).add_sms_count!(options) if mobile.present?
  end
end
